﻿<UserControl x:Class="iDesign.Media.Burner.Views.MediaView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:conv="clr-namespace:iDesign.Media.Burner.Converters"
             xmlns:vm="clr-namespace:iDesign.Media.Burner.ViewModels" Width="700" Height="500" 
             Background="{DynamicResource  WindowBackgroundBrush}"   
             
            >
    
    
 
    <UserControl.Resources>  

        
        <conv:DiscRecorderValueConverter x:Key="discRecorderValueConverter"/>

        <!-- 
  This template applies an AllCustomersViewMediaView to an instance 
  of the MediaViewModel class shown in the main window.
  -->

        <vm:MediaViewModel  x:Key="MediaViewModel"/>
        <!--<DataTemplate DataType="{x:Type vm:MediaViewModel}">
            <vw:MediaView />
        </DataTemplate>-->


        <Style x:Key="MediaItemStyle"   TargetType="{x:Type ListBoxItem}">

            <!-- 
      Bind the IsSelected property of a ListViewItem to the 
      IsSelected property of a MediaViewModel object.
      -->
            <Setter Property="IsSelected"  Value="{Binding Path=IsSelected, Mode=TwoWay}" />
            <Style.Triggers>
                <MultiTrigger>
                    <MultiTrigger.Conditions>
                        <Condition Property="ItemsControl.AlternationIndex" Value="1" />
                        <Condition Property="IsSelected" Value="False" />
                        <Condition Property="IsMouseOver" Value="False" />
                    </MultiTrigger.Conditions>          
                </MultiTrigger>
            </Style.Triggers>
        </Style>

    </UserControl.Resources>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition MaxHeight="35" />
        </Grid.RowDefinitions>


        <TabControl Grid.Row="0"  Style="{DynamicResource BlueTabControl}"              Background="{DynamicResource  WindowBackgroundBrush}"     DataContext="{StaticResource MediaViewModel}" >

            <TabItem Header="Burn Files"  Style="{DynamicResource BlueTabItem}">
            <Grid >
                <Grid.RowDefinitions>
                    <RowDefinition Height="50"  />
                    <RowDefinition />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="5.5*"/>
                    <ColumnDefinition Width="4.5*" />
                </Grid.ColumnDefinitions>

                <DockPanel Grid.Row="0">
                    <ComboBox x:Name="devicesComboBox" DockPanel.Dock="Left" VerticalAlignment="Top" 
                      Width="196" Height="22" Margin="10" 
                              IsSynchronizedWithCurrentItem="True"
                              ItemsSource="{Binding DiscRecorders}" >
                        
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Converter={StaticResource discRecorderValueConverter}}"/>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>

                    <!-- will hide this for now, may need it in t he future -->

                    <StackPanel Visibility="Collapsed" DockPanel.Dock="Right" Orientation="Horizontal">
                        <Label Content="Supported Media:" Margin="10,10,0,0" />

                        <Label Margin="5,2.5" MaxWidth="300">
                            <TextBlock x:Name="supportedMediaLabel" Text="{Binding Path=SupportedMedia}" TextWrapping="WrapWithOverflow"/>
                        </Label>

                    </StackPanel>
                </DockPanel>

                <GroupBox Header="Files to burn" Grid.Row="1" Grid.Column="0" >
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto"  />
                            <RowDefinition Height="Auto"  />
                            <RowDefinition Height="Auto"  />
                            <RowDefinition Height="Auto"  />
                        </Grid.RowDefinitions>
                            <!--<ListView SelectionMode="Multiple" Visibility="Hidden"   Margin="5" Height="124" Width="315" Grid.Row="0" ItemsSource="{Binding Path=MediaItems}">
                            <ListView.View>
                                <GridView>
                                    <GridViewColumn Width="25"   DisplayMemberBinding="{Binding FileIconImage}" />
                                    <GridViewColumn Width="120" Header="Name"  DisplayMemberBinding="{Binding Path}" />                                                                            
                                   
                                </GridView>
                            </ListView.View>

                        </ListView>-->

                        <ListBox  SelectionMode="Multiple" Margin="5" Height="124" Width="315" ItemContainerStyle="{StaticResource MediaItemStyle}" x:Name="listBoxFiles" Grid.Row="0" ItemsSource="{Binding Path=MediaItems}">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition />
                                            <ColumnDefinition />
                                        </Grid.ColumnDefinitions>                                        
                                        <Image Grid.Column="0" Source="{Binding Path=FileIconImage}" />
                                        <TextBlock Grid.Column="1" Text="{Binding Path=Path}" />
                                            
                                    </Grid>

                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <StackPanel  Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center"  >
                            <Button x:Name="buttonAddFiles" Width="106" Height="30" Content="Add Files" Command="{Binding AddFilesCommand}" Style="{DynamicResource  NuclearBlueButton}" >
         
                            </Button>
                                <Button x:Name="buttonAddFolders" Width="106" Content="Add Folders" Height="30" Margin="10" Style="{DynamicResource NuclearBlueButton}" Command="{Binding Path=AddFoldersCommand}" >
                                    </Button>
                                <Button x:Name="buttonRemoveFiles" Width="106" Content="Remove"  Style="{DynamicResource NuclearBlueButton}" Height="30" Command="{Binding Path=RemoveMediaItemsCommand}">
                            </Button>
                        </StackPanel>

                        <StackPanel  Grid.Row="2" Orientation="Horizontal"  >
                            <Label Margin="50,0,0,0" Width="120" Height="25" Content="Volume label:" />
                            <TextBox x:Name="textBoxLabel"  Text="{Binding Path=VolumeLabel}" Width="120" Height="25"/>

                        </StackPanel>


                        <StackPanel  Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Left"  >
                            <CheckBox x:Name="checkBoxCloseMedia" IsChecked="{Binding Path=ShouldCloseMedia}" Content="Close media" Margin="20,5,0,0"  />
                            <CheckBox x:Name="checkBoxEject" IsChecked="{Binding Path=ShouldEject}"  Content="Eject when finished" Margin="60,5,0,0" />

                        </StackPanel>

                        <StackPanel  Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Left"  >
                            <Label Content="Verification:" Margin="30,5,0,0"  />
                            <ComboBox x:Name="comboBoxVerification" Width="150" Height="25"  Margin="20,5,0,0" ItemsSource="{Binding Path=VerificationTypes}" >
                                <!--<ComboBoxItem Content="None" />
                                <ComboBoxItem Content="Quick" />
                                <ComboBoxItem Content="Full" />-->
                            </ComboBox>

                        </StackPanel>

                            <Button Grid.Row="5" Width="70" Height="30" Margin="3" Style="{DynamicResource NuclearGreenButton}" Content="Eject" Command="{Binding Path=EjectCommand}" ></Button>


                    </Grid>

                </GroupBox>

                <Grid Grid.Row="1"  Grid.Column="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />

                    </Grid.RowDefinitions>
                    <GroupBox Header="Selected media type" Grid.Row="0">

                        <Grid  Grid.Column="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="*"  />
                                </Grid.ColumnDefinitions>

                                <Button x:Name="buttonDetectMedia" Grid.Row="0" Grid.Column="0"   Width="98" Height="28"  Style="{DynamicResource NuclearGreenButton}"  Content="Detect Media" VerticalAlignment="Top" Margin="10" Command="{Binding Path=DetectMediaCommand}" />
                            <Label  x:Name="labelMediaType" Foreground="Red" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center"  Margin="0,5,0,0" Content="{Binding Path=MediaType}" />

                            <Label Grid.Row="1" Grid.Column="0"  Content="0" Margin="15,30,0,0"/>
                            <Label x:Name="labelTotalSize" Grid.Row="1" Grid.Column="1"  Content="{Binding Path=TotalSize}" HorizontalAlignment="Right" Margin="0,30,15,0"/>
                                <ProgressBar x:Name="progressBarCapacity" Grid.Row="2" Value="{Binding Path=CapacityProgressValue}" Foreground="{Binding Path=CapacityProgressBrush}" Grid.ColumnSpan="2" Height="16" Width="224"     VerticalAlignment="Center" HorizontalAlignment="Center" >
                                    <ProgressBar.Resources>
                                        <ResourceDictionary Source="/PresentationFramework.Aero;v3.0.0.0;31bf3856ad364e35;component/themes/aero.normalcolor.xaml"/>
                                    </ProgressBar.Resources>
                                </ProgressBar>
                            </Grid>


                    </GroupBox>
                    <GroupBox Header="Progress"  Grid.Row="1">
                            <StackPanel  HorizontalAlignment="Center"  >

                                <Label HorizontalAlignment="Center" VerticalAlignment="Bottom"  Margin="0,40,0,10" MaxWidth="120">
                                    <TextBlock x:Name="labelStatusText" TextWrapping="WrapWithOverflow" Text="{Binding Path=BurnStatusMsg}"/>
                                </Label>

                                <ProgressBar x:Name="statusProgressBar"  Height="16" Width="224" >
                                    <ProgressBar.Resources>
                                        <ResourceDictionary Source="/PresentationFramework.Aero;v3.0.0.0;31bf3856ad364e35;component/themes/aero.normalcolor.xaml"/>
                                    </ProgressBar.Resources>


                                </ProgressBar>
                                <Button x:Name="buttonBurn"   Width="120" Height="55"  Margin="10" Content="Burn" Style="{StaticResource NuclearGreenButton}" Command="{Binding Path=BurnCommand}" >
                                </Button>

                            </StackPanel>

                        </GroupBox>
                </Grid>





            </Grid>
            
            </TabItem>

            <TabItem Header="Format Disk" x:Name="tabPageFormat"  Style="{DynamicResource BlueTabItem}">

                <Grid HorizontalAlignment="Center">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />

                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0"  HorizontalAlignment="Center" Margin="0,40,0,0" >



                        <CheckBox x:Name="checkBoxEjectFormat" IsChecked="{Binding Path=ShouldEjectFormat}"  Content="Eject when finished" Margin="5"/>
                        <CheckBox x:Name="checkBoxQuickFormat" IsChecked="{Binding Path=ShouldFormatQuick}"  Content="Quick format" Margin="5"  />

                    </StackPanel>

                    <Button x:Name="buttonFormat" Grid.Row="1"  Width="120" Height="30"  Style="{DynamicResource NuclearGreenButton}" Content="Format Disk" VerticalAlignment="Top" Margin="20" Command="{Binding Path=FormatCommand}"/>

                    <Label x:Name="labelFormatStatusText" Grid.Row="2" Margin="0,40,0,10"   Content="{Binding Path=FormatStatusMsg}" HorizontalAlignment="Center" />
                    <ProgressBar x:Name="formatProgressBar" Value="{Binding Path=FormatProgressValue}"  Grid.Row="3"  Height="22" Width="360"  VerticalAlignment="Center" HorizontalAlignment="Center">
                        <ProgressBar.Resources>
                            <ResourceDictionary Source="/PresentationFramework.Aero;v3.0.0.0;31bf3856ad364e35;component/themes/aero.normalcolor.xaml"/>
                        </ProgressBar.Resources>
                    </ProgressBar>
                </Grid>

            </TabItem>
    </TabControl>



    </Grid>


</UserControl>

